from common.flask_package import *
from model.user import *
from common.my_msg import *

bp_user = Blueprint('user', __name__, url_prefix='/user')

#管理员登录
@bp_user.route('/login', methods=['POST'])
def user_login():
    if request.method == 'POST':
        username=request.form['username']
        password=request.form['password']
        relust=User.query_login(username,password)
        if relust==0:
            data={
                'code':state_ok(),
                'msg':'登录成功',
            }
        else:
            data = {
                'code': state_error(),
                'msg': '登录失败',
            }
    return jsonify(data)




